import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayTransVO, PayTransForm, PayTransQuery } from '@/api/authcode/payTrans/types';

/**
 * 查询支付流水列表
 * @param query
 * @returns {*}
 */

export const listPayTrans = (query?: PayTransQuery): AxiosPromise<PayTransVO[]> => {
  return request({
    url: '/authcode/payTrans/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询支付流水详细
 * @param transId
 */
export const getPayTrans = (transId: string | number): AxiosPromise<PayTransVO> => {
  return request({
    url: '/authcode/payTrans/' + transId,
    method: 'get'
  });
};

/**
 * 新增支付流水
 * @param data
 */
export const addPayTrans = (data: PayTransForm) => {
  return request({
    url: '/authcode/payTrans',
    method: 'post',
    data: data
  });
};

/**
 * 修改支付流水
 * @param data
 */
export const updatePayTrans = (data: PayTransForm) => {
  return request({
    url: '/authcode/payTrans',
    method: 'put',
    data: data
  });
};

/**
 * 删除支付流水
 * @param transId
 */
export const delPayTrans = (transId: string | number | Array<string | number>) => {
  return request({
    url: '/authcode/payTrans/' + transId,
    method: 'delete'
  });
};
